<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
	<title>欢迎您登录</title>
	<link rel="stylesheet" href="${ctx}/static/plugin/bootstrap/css/bootstrap.min.css"  />
<script>
	$(document).ready(function() {
		
		mz_datatbles.dt();
	});
	var oTable;
	mz_datatbles = {
		dt:function(){
			if($('#listTable').length) {
				oTable = $("#listTable").dataTable({
		    		"fnServerParams": function ( aoData ) {
		    			jQuery.each( $("form#listForm").serializeArray(), function(i, field){
		    				aoData.push( field );    
						});
		    		} ,
		        	"bServerSide": true,
		        	"bProcessing": true,
		        	"bSort" : true, 
		        	"sPaginationType": "bootstrap",
		        	"sDom": "<r>t<'row'<'span6'li><'span6'p>>",
		        	"sAjaxSource": "${ctx}/cases/cases/list",
		        	"oLanguage": {  
		        		"sProcessing": "数据加载中",
		        		"sLoadingRecords": "Please wait - loading...",
		        		"sLengthMenu": "每页显示 _MENU_ 行&nbsp;",
		        		"sSearch": "_INPUT_",
		        		"oPaginate": {       "sFirst": "首页" ,  "sPrevious": "前页" ,"sNext": "下页", "sLast": "尾页"     },
		        		"sZeroRecords": "未找到符合条件的数据",
		        		"sEmptyTable": "未找到符合条件的数据"
		        	} ,
		       	 	"aoColumns": [
						{ "mDataProp": "casesName", "sName": "casesName", "sClass": "center" },
						{ "mDataProp": "casesTitle", "sName": "casesTitle", "sClass": "center" },
						{ "mDataProp": "casesDesc", "sName": "casesDesc", "sClass": "center" },
						{ "mDataProp": "statusName", "sName": "statusName", "sClass": "center" },
						{ "mDataProp": "createDateStr", "sName": "createDateStr", "sClass": "center" },
						{ "mDataProp": "createBy", "sName": "createBy", "sClass": "center" },
						{ "bSortable": false, "mDataProp": null, "sClass": "center",
							"fnRender" : function(oObj) {
								var status = oObj.aData.status;
								var html = 
									'<a title="预览案例" class="sepV_a" href="${ctx}/cases/cases/view/'+oObj.aData.casesId+'">' +
									'<i class="icon-eye-open"></i></a>';
								if(status=="S"||status=="WaDEL"){
									 html = html+
									'<a title="审核" class="sepV_a" href="${ctx}/cases/cases/audit/'+oObj.aData.casesId+'">' +
									'<i class="icon-adjust"></i></a>'
								}
								
								if(status!="WaDEL"){
								html=html+
											'<a title="删除" class="sepV_a" onclick="return delConfirm()" href="${ctx}/cases/cases/delete/'+oObj.aData.casesId+'">' +
											'<i class="icon-trash"></i></a>';
											
											html=html +
											'<a title="修改" class="sepV_a" href="${ctx}/cases/cases/update/'+oObj.aData.casesId+'">' +
											'<i class="icon-pencil"></i></a>';
								}
								return html; 
							}
						}
					] ,
					"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
		        		getFrameHeight();
		        		return "&nbsp;"+(iTotal>0?iStart:0)+" ~ "+iEnd+" 行 总共"+iTotal+"行 ";  
		        	} 
		    	});
			}
		}
	};
var message = '${message}';
if(message!=null && message!=""){
	alert(message);
}

function delConfirm(){
	if(confirm("是否删除,没有通过审核的会直接删除!")){
		return true;
	}else{
		return false;
	}
}

function toSave(){
	//alert("333")
	window.location.href = "${ctx}/cases/cases/create";
}
</script>
</head>

<body>
        	<div>
            	<div id="jCrumbs" class="breadCrumb module">
				    <ul>
				        <li>
				            <a href="#"><i class="icon-home" style="margin-top: 2px;"></i></a>
				        </li>
				        <li>
				            	案例管理
				        </li>
				        <li>
				            	案例列表
				        </li>
				    </ul>
				</div>
				<div class="row-fluid">
		    		<div class="span12">
		        		<div class="row-fluid">
							<div class="span12">
								<form name="listForm" id="listForm">
									<table class="table table-bordered table-striped table_vam dataTable">
										<tbody>
											<tr>
												<th>案例名称</th>
												<td>
													<input type="text" name="casesName" />
												</td>
												<th>案例标题</th>
												<td>
													<input type="text" name="casesTitle" />
												 </td>
											</tr>
											<tr>
												<td colspan="4">								
													<div class="row">
														<div class="span4">
															<div class="dt_actions"><div class="btn-group"></div></div>
														</div>
														<div class="span4 center">
															<button class="btn  btn_search" type="button" onclick="oTable.fnDraw();">查询</button>&nbsp;&nbsp;&nbsp;&nbsp;
															<button class="btn" type="reset">重置</button>
														</div>
														<div class="span4">
															<div class="btn-group pull-right">
																	<button class="btn" style="background-color: #D7E6FA" type="button" onclick="toSave()">新增案例</button>
															</div>
														</div>
													</div>
												</td>
											</tr>
										</tbody>
									</table>
								</form>
							</div>
						</div>
					<table id="listTable" class="table table-bordered table-striped table_vam dataTable">
		            	<thead>
		                	<tr>
								<th>案例名称</th>
   								<th>案例标题</th>
   								<th>案例说明</th>
   								<th>状态</th>
   								<th>创建时间</th>
   								<th>创建人</th>
   								<th class="center sorting">操作</th>
							</tr>
		            	</thead>
		            	<tbody>
		                	<tr>
		                    	<td class="dataTables_empty" colspan="6"></td>
		                	</tr>
		            	</tbody>
		        	</table>
		        </div>
		    </div>
		</div>
</body>
</html>
